<template>
    <div class="box">
        <div class="login_box">
            <div style="text-align: center;">
                <img :src="require('@/assets/image/logo4.png')" class="login_logo" style="margin-right: 20px;" />
               
            </div>
            <div class="login_title">
                全平台通用整蛊插件
            </div>
            <div style="display: flex;
    justify-content: center;">
                <el-form @submit.native.prevent ref="loginForm" :model="form" label-width="0" :rules="rules">
                    <el-form-item label="" prop="username">
                        <el-input v-model="form.username" @keyup.enter.native="submitForm()" placeholder="卡密："></el-input>
                    </el-form-item>
                    <el-form-item label="">
                        <el-button type="primary" @click="submitForm()">登录</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </div>
    </div>
</template>

<script>
import {  Login } from '../../wailsjs/go/main/App'

export default {

    name: 'MyYongjieLogin',

    data() {
        return {
            rules: {
                username: [
                    { required: true, message: '请输入卡密', trigger: "blur", },
                ],
            },
            form: {
                username: null
            }
        };
    },
    mounted() {
        window.updatedUsername = (value) => this.updatedUsername(value);
    },
    methods: {
        // 修改卡密
        updatedUsername(value) {
            this.form.username = value;
        },
        // 提交
        submitForm(formName) {
            let _this = this;
            _this.$router.push('/home/streaming')
            // this.$refs.loginForm.validate((valid) => {
            //     if (valid) {
            //       Login(_this.form.username).then(res=>{
            //             if (res === '1') {
            //                 _this.$router.push('/home/streaming')
            //             } 
            //         })
                  
            //     } else {
            //         return false;
            //     }
            // })
        }
    },
};
</script>

<style lang="less" scoped>
.box {
    width: 100%;
    height: 100%;
    background: #000;
}

::v-deep .login_box {
    --wails-draggable: no-drag;
    position: absolute;
    width: 80%;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 10px;
    text-align: center;

    .el-image__inner {
        width: 100%;
        height: 100%;
    }

    .login_title {
        font-size: 55px;
        margin: 15px 0 40px 0;
    }

    .login_logo {
        width: 210px;
        height: 105px;
    }
}

::v-deep .el-form {
    width: 350px;

    .el-button {
        padding: 12px 157px;
        font-size: 16px;
    }
}
</style>